package com.cq.hd.member.controller;

import com.cq.hd.common.pagination.Page;
import com.cq.hd.common.response.Result;
import com.cq.hd.common.response.ResultGenerator;
import com.cq.hd.member.api.TbAgentBindApplyApi;
import com.cq.hd.member.api.dto.*;
import com.cq.hd.member.api.vo.AgentBindApplyPageVo;
import com.cq.hd.member.api.vo.AgentBindApplyVo;
import com.cq.hd.member.api.vo.MyAgentBindApplyPageVo;
import com.cq.hd.member.api.vo.PreAgentApplyVo;
import com.cq.hd.member.service.TbAgentBindApplyService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 经纪人入驻申请记录表 前端控制器
 * </p>
 *
 * @author mYunYu
 * @since 2024-01-18
 */
@RestController
public class TbAgentBindApplyController implements TbAgentBindApplyApi {

    @Autowired
    private TbAgentBindApplyService agentBindApplyService;

    @Override
    public Result<PreAgentApplyVo> preApply(PreAgentEnterApplyDto preAgentApplyMerchantDto) {
        return ResultGenerator.success(agentBindApplyService.preApply(preAgentApplyMerchantDto));
    }

    @ApiOperation(value = "经纪人绑定申请")
    @Override
    public Result<AgentBindApplyVo> apply(AgentBindApplyDto agentApplyDto) {
        return ResultGenerator.success(agentBindApplyService.apply(agentApplyDto));
    }

    @ApiOperation(value = "待审核经纪人数量")
    @Override
    public Result<Integer> waitAuditCount(Long inviterUserId) {
        return ResultGenerator.success(agentBindApplyService.waitAuditCount(inviterUserId));
    }

    @ApiOperation(value = "入驻列表")
    @Override
    public Result<Page<AgentBindApplyPageVo>> page(AgentBindApplyPageDto agentBindApplyPageDto) {
        return ResultGenerator.success(agentBindApplyService.page(agentBindApplyPageDto));
    }

    @ApiOperation(value = "我的入驻申请列表")
    @Override
    public Result<Page<MyAgentBindApplyPageVo>> myApplyPage(MyAgentBindApplyPageDto myAgentBindApplyPageDto) {
        return ResultGenerator.success(agentBindApplyService.myApplyPage(myAgentBindApplyPageDto));
    }

    @Override
    public Result<Boolean> audit(AgentBindApplyAuditDto agentBindApplyAuditDto) {
        return ResultGenerator.success(agentBindApplyService.audit(agentBindApplyAuditDto));
    }
}
